#include <iostream>
#include <pthread.h>
#include <unistd.h>
using namespace std;

static void Print(const char* name,pthread_t tid)
{
    cout<<name<<" 正在运行"<<tid<<endl;
}

void *routine(void* argv)
{
    const char* name = static_cast<const char*>(argv);
    while(true)
    {
        Print(name,pthread_self());
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    int n = pthread_create(&tid,nullptr,routine,(void*)"thread");
    while(true)
    {
        cout<<"main thread run"<<endl;
        sleep(1);
    }
    return 0;
}